package uk.co.q3c.deplan.google;

import org.testng.Assert;
import org.testng.annotations.Test;

import uk.co.q3c.deplan.server.unit.dao.LocalDatastoreTestCase;

import com.google.appengine.api.datastore.EntityNotFoundException;
import com.googlecode.objectify.Key;
import com.googlecode.objectify.Objectify;
import com.googlecode.objectify.ObjectifyService;

@Test
public class UsingArrays extends LocalDatastoreTestCase {

	public void doit() throws EntityNotFoundException {
		TestObjectWithArray tob = new TestObjectWithArray();
		Objectify ofy = ObjectifyService.begin();
		ofy.put(tob);
		tob.setDone(1, 3);
		Key<Object> key = ofy.getFactory().getKey(tob);

		ofy = ObjectifyService.begin();
		TestObjectWithArray tob2 = (TestObjectWithArray) ofy.get(key);
		Assert.assertEquals(tob2.getDone(1), 3);
	}

}
